package com.chennan.pattern.chain.upgrade;

import com.chennan.pattern.chain.low.PreparationList;
import com.chennan.pattern.chain.low.Study;
import com.chennan.pattern.chain.upgrade.impl.HaveBreakfastFilter;
import com.chennan.pattern.chain.upgrade.impl.WashFaceFilter;
import com.chennan.pattern.chain.upgrade.impl.WashHairFilter;

/**
 * @author chennan
 * @createTime 2022年02月24日 17:26:00
 */
public class TestUpgrade {

    public static void main(String[] args) {
        PreparationList preparationList = new PreparationList();
        preparationList.setWashFace(true);
        preparationList.setWashHair(false);
        preparationList.setHaveBreakfast(true);

        Study study = new Study();

        StudyPrepareFilter washFaceFilter = new WashFaceFilter();
        StudyPrepareFilter washHairFilter = new WashHairFilter();
        StudyPrepareFilter haveBreakfastFilter = new HaveBreakfastFilter();

        FilterChain filterChain = new FilterChain(study);
        filterChain.addFilter(washFaceFilter);
        filterChain.addFilter(washHairFilter);
        filterChain.addFilter(haveBreakfastFilter);

        filterChain.doFilter(preparationList, filterChain);
    }
}
